#!/bin/bash

usage( ){
cat <<EOF
Usage:
    compare <filename><dirl> <dir2>
EOF
exit
}

compare2()
{
    filename=$1
    dir1=$2
    dir2=$3
    echo "${filename} ${dirl} ${dir2}"
    file1=`find ${dir1} -name ${filename}`
    file2=`find ${dir2} -name ${filename}`
    vimdiff ${file1} ${file2}
}

compareallfile()
{
    filename=$l
    files= findname ${filename}
    echo "$files"
    vimdiff ${files}
}

if [ $# -eq 3 ];then
    echo "compare2"
    compare2 $1 $2 $3
elif [ $# -eq 1 ];then
    compareallfile $1
else
    usage
fi
